<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  
  <meta name="generator" content="Hugo 0.98.0" />

  
  <meta name="description" content="走在通往幸福的路上">
  

  
  <link rel="apple-touch-icon" sizes="180x180" href="https://blog.v5u.win/apple-touch-icon.png">

  
  <link rel="icon" type="image/png" sizes="32x32" href="https://blog.v5u.win/favicon-32x32.png">

  
  <link rel="icon" type="image/png" sizes="16x16" href="https://blog.v5u.win/favicon-16x16.png">

  
  <link rel="manifest" href="https://blog.v5u.win/site.webmanifest">

  
  <link rel="mask-icon" href="https://blog.v5u.win/safari-pinned-tab.svg" color="">

  <meta name="msapplication-TileColor" content="">

  <meta name="theme-color" content="">

  
  <link rel="stylesheet" href="https://blog.v5u.win/css/bootstrap.min.css" />

  
  <title>centos7 PHP7环境配置 | 为吾优</title>
  

  <style>
body {
  min-width: 300px;
}

.custom-navbar {
  margin-bottom: 1em;
  height: 60px;
}

.custom-navbar a {
  display: inline-block; 
  padding: 18px 0;
  margin-right: 1em; 
  font-weight: bold; 
}

.custom-navbar a:hover,
.custom-navbar a:focus {
  text-decoration: none; 
}

@media print {
  .custom-navbar {
    display: none;
  }
}

article {
  padding-bottom: 1em;
}

img {
  max-width: 100%;
}


body {
  background-color: #fff;
}



body {
  color: #212529;
}



a {
  color: #007bff;
}



a:hover,
a:focus {
  color: #0056b3;
}



.custom-navbar {
  background-color: #212529;
}



.custom-navbar a {
  color: rgba(255,255,255,.75);
}



.custom-navbar a:hover,
.custom-navbar a:focus {
  color: rgba(255,255,255,1);
}



.container {
  max-width: 800px;
}





</style>
</head>

<body>
  <nav class="custom-navbar">
  <div class="container">
    
    <a href="/">文章</a>
    
    <a href="/tags/">标签</a>
    
    <a href="/about/">关于</a>
    
    <a href="/index.xml">RSS</a>
    
  </div>
</nav>
  
  <div class="container">
    <article>
      <h1>centos7 PHP7环境配置</h1>
<p>centos7 PHP7环境配置 目录 1. 开启22端口2. 创建其他用户，使用其他用户ssh登录（root账户禁止登录）3. 关闭防火墙4. 关闭selinux5. 安装Apache6. 安装MySQL7. 安装PHP7.28. 配置 [TOC]</p>
<ol>
<li>
<p>开启22端口</p>
</li>
<li>
<p>创建其他用户，使用其他用户ssh登录（root账户禁止登录）</p>
</li>
</ol>
<p>ssh <a href="mailto:test@10.211.55.5">test@10.211.55.5</a> (使用eth0网卡IP)</p>
<ol>
<li>
<p>关闭防火墙</p>
<p>centos7 默认使用firewalld，不在内置iptables
//临时关闭
systemctl stop firewalld
//禁止开机启动
systemctl disable firewalld</p>
</li>
<li>
<p>sudo yum -y install iptables-services</p>
</li>
<li>
<p>sudo vi /etc/sysconfig/iptables</p>
</li>
<li>
<p>systemctl restart iptables.service （重启）</p>
</li>
<li>
<p>systemctl enable iptables.service （开机自启动iptables）注：并不能开机自动关闭firewalld</p>
</li>
<li>
<p>关闭selinux</p>
</li>
</ol>
<p>gedit /etc/sysconfig/selinux</p>
<ol>
<li>
<p>安装Apache</p>
</li>
<li>
<p>sudo yum install httpd</p>
</li>
<li>
<p>sudo service httpd start</p>
</li>
<li>
<p>service httpd state</p>
</li>
<li>
<p>安装MySQL</p>
</li>
</ol>
<p>sudo yum install mysql-server （失败）</p>
<ol>
<li>
<p>安装PHP7.2</p>
</li>
<li>
<p>sudo yum install <a href="http://rpms.remirepo.net/enterprise/remi-release-7.rpm">http://rpms.remirepo.net/enterprise/remi-release-7.rpm</a></p>
</li>
<li>
<p>yum install yum-utils</p>
</li>
<li>
<p>yum-config-manager &ndash;enable remi-php72</p>
</li>
<li>
<p>yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo (安装PHP模块)</p>
</li>
<li>
<p>php -v</p>
</li>
<li>
<p>配置</p>
</li>
<li>
<p>sudo chkconfig httpd on （Apache重启）</p>
</li>
<li>
<p>sudo nano /var/www/html/info.php （编辑PHP文件）</p>
</li>
<li>
<p>sudo service httpd restart</p>
</li>
<li>
<p>sudo vi /var/www/html/index.php (添加并编辑index.php)</p>
</li>
<li>
<p>修改Apache配置文件 /etc/httpd/conf/httpd.conf</p>
</li>
</ol>

    </article>
  </div>

  
  
  

  
</body>

</html>